package day38.edu;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

// Created: 08/10/2025, ChangJiang Ru
public class GenericTest {
    public static void main(String[] args)
    {
        Person s1 = new Person();
        s1.setT("Tom");
        s1.setOrderId(23);

        Person s2 = new Person("Jerry", 43);
        Object t = s2.getT();

        Person<String> s3 = new Person<String>("pineapple", 12);
        String t1 = s3.getT();
        s3.setT("apple");
        System.out.println(s3.getT());
    }
    
    @Test
    public void test1()
    {
        List<?> list = null;
        List<Object> list1 = null;
        List<String> list2 = null;

        list = list1;
        list = list2;

        method(list1);
        method(list2);
    }

    public void method(List<?> list)
    {

    }

    @Test
    public void test2()
    {
        List<?> list = null;
        List<String> list1 = new ArrayList<>();

        list1.add("AA");

        list = list1;

        Object obj = list.get(0);
        System.out.println(obj);
    }
}
